﻿Imports System.Data.SqlClient
Public Class FormUser
    Private Sub btnCancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCancel.Click
        Me.Close()
    End Sub
    Private Sub FormUser_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Me.MdiParent = MDIParent1
    End Sub

    Private Sub btnOk_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOk.Click
        If txtusername.Text.Trim() = "" Then
            MsgBox("Please Input Username!")
            txtusername.Focus()
            Exit Sub
        End If
        If txtpwd.Text.Trim = "" Then
            MsgBox("Please Input Password!")
            txtpwd.Focus()
            Exit Sub
        End If
        Cmd.Parameters("@u") = txtusername.Text
        Cmd.Parameters("@pwd") = txtpwd.Text
        If Cmd.ExecuteScalar("SELECT * FROM TBL_USER WHERE UserName LIKE @u AND Password  LIKE @pwd ") Then
            MessageBox.Show("success")

            Me.Hide()
        Else
            MessageBox.Show("fail")
        End If
        MDIParent1.Show()
    End Sub
End Class